﻿using System.Collections.Generic;
using System.Drawing;

namespace TSP
{
    class Vertex
    {
        Point position;

        public Point Position
        {
            get { return position; }
            set { position = value; }
        }
        int color; //for Kruskal

        public int Color
        {
            get { return color; }
            set { color = value; }
        }
        List<Edge> neighbours;

        internal List<Edge> Neighbours
        {
            get { return neighbours; }
            set { neighbours = value; }
        }

        public Vertex(Point p)
        {
            position = p;
            color = -1;
            neighbours = new List<Edge>();
        }
        public Vertex(Vertex v)
        {
            position = v.position;
            color = v.color;
            neighbours = v.neighbours;
        }

        public void addEdge(Vertex to, double w)
        {
            neighbours.Add(new Edge(this, to, w));
        }

        public string print()
        {
            string output = "Vertex: <" + this.Position.X + "," + this.Position.Y + ">\n";
            output += "Edges: \n";
            foreach (Edge e in Neighbours)
            {
                output += e.print();
            }
            return output;
        }
    }
}
